<?php
require_once "../config.php";
require_once SESSION_INCLUDE;
require_once DB;
require_once GALLERY;

session_start();

	$db = get_session_db($db_config);
	
	if(!user_is_logged($db))
	{
		header("Location:http://".LOGIN_FILE);
		exit();
	}
	
	$user = get_session_user();
	
	$gallery_id = null;
	if(!isset($_POST['select_gallery']))
	{
		header("HTTP/1.1 304 Not Modified");
		exit();
	} else $gallery_id = $_POST['select_gallery'];
	
	$gallery = Gallery::getGalleryFromId($db, $gallery_id);
	
	if($gallery->getSize() > 0)
	{
		header("HTTP/1.1 304 Not Modified");
		exit();
	}
	else
	{
		$gallery->cancel();
		echo "Galleria cancellata";
	}
?>
